package com.example.hystrixDemo.rxjava;/**
 * @Deacription TODO
 * @Author baohuajie
 * @Date 2020/12/15 14:33
 * @Version 1.0
 **/


import rx.Observable;
import rx.Observer;

/**
 *@Deacription TODO
 *@Author baohuajie
 *@Date 2020/12/15 14:33
 *@Version 1.0
 **/
public class Main3 {
    public static void main(String[] args) {
        String[] array = {"str1", "str2", "str3"};

//        Observable observable = Observable.from(array);
        Observable observable = Observable.just("s1", "s3");

        Observer<String> observer = new Observer<String>() {

            @Override
            public void onCompleted() {
                System.out.println("消息接收完毕");
            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(String s) {
                System.out.println("观察者收到消息:" + s);
            }
        };

        observable.subscribe(observer);


    }
}
